<?php
	include "common.php";
	session_start();
	error_reporting(0);
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$userLink = $_SESSION['userLink'];
	if($userLink!="ceo.php"){
		echo "Sorry, You have no right to visit this page!!";
		exit;
	}
	$eid = $_SESSION['id'];
	$userFname = $_SESSION['userFname'];
	$userLname = $_SESSION['userLname'];
	$supervisor = $_SESSION['supervisor'];
	$role = $_SESSION['role'];
	
	$userSql = "SELECT * FROM user WHERE e_id = '$eid'";
	$userSqlQuery = mysql_query($userSql);
	$userSqlResult = mysql_fetch_assoc($userSqlQuery);
	
	$email = $userSqlResult['email'];
	$timezone_offset = 6; // for getting local time offset hrs
	$systemDate = gmdate('y-m-d', time()+$timezone_offset*60*60);
	$compToday = strtotime($systemDate);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="index.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="blackbox.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="curvycorners.src.js" type="text/javascript"></script>
<script src="login.js" type="text/javascript"></script>
<title><?php echo "Welcome to ".$userFname." ".$userLname; ?></title>
</head>

<body>
<div class="main_div_other">
	<p><img src="images/creato_logo.jpg" /></p>
    <p id="creatobd">www.creatobd.com</p>
    <p id="date"><script>document.write(new_month+" "+new_date+", "+old_date.getFullYear()+" || "+new_day);</script></p>
    <div class="other_page_icons">
    	<div class="new_notification">
        	<img src="images/arrow_up.JPG" /><?php if ($notification >0){?><p>You have<?php echo " ".$notification." ";?>new notification</p><?php }?>
        </div><!--end of new_notification-->
		
    	<ul>
        	<a href="ceo.php"><li><div id="home"></div><p>home</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="ceo_employee.php"><li><div id="employee"></div><p>employee</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="on_duty.php"><li><div id="onduty"></div><p>on duty</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="ceo_attendance.php"><li><div id="attendance"></div><p>attendance</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="leave.php"><li><div id="leave"></div><p>leave</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="ceo_notification.php"><li><div id="notification"></div><p>notification</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="ceo_blackbox.php"><li><div id="blackbox"></div><p>black box</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="ceo_notice.php"><li><div id="hrpolicy"></div><p>hr policy</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="index.php"><li><div id="logout"></div><p>log out</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
        </ul>

    </div><!-- end of other_page_icons-->
    
</div><!-- end of main_div_other-->
<div class="othrpage_1">
    <p>view as: <a href="ceo_blackbox.php?check=1">send</a> | <a href="ceo_blackbox.php?check=2">Check All Messages</a> |
	<a href="ceo_blackbox.php?check=3">Inbox</a></p>
</div><!-- end of othrpage_1-->
<div class="human_portal">
  		<p>creato human resourse portal</p>
</div><!-- end of human_portal-->
<div class="page_content">	
	<?php 
		$checkSubmit = $_GET['check'];
		if ($checkSubmit == 1)
		{
	?>
			<p>Black Box Message</p>
			<form method="post" action="blackbox.php">
			<table cellpadding="0" cellspacing="0" class="apply4leave_table">
				<td>To Whom Id</td>
					<td><select name="id">
							<option value="51">Alamgir Hossain</option><option value="52">Rahat Hayat</option>
							<option value="54">Bahadur Imam</option><option value="55">Jakir Hossain</option><option value="56">T.I. Shohag</option>
							<option value="57">Mahin</option><option value="58">Md. Shakil</option><option value="60">Ruhul Amin</option>
							<option value="61">Raqibul Hasan</option><option value="64">A S M Nahid</option><option value="65">Waliur Rahman</option>
							<option value="66">Atukur Rahman</option><option value="67">Nur Arefin</option><option value="68">Subarna Sharika</option>
							<option value="69">Alamin Alamin</option><option value="70">Zaiuddin Babu</option><option value="71">Md. Jashim </option>
							<option value="72">Raiana Salmin</option><option value="73">Obaidur Rahman</option><option value="74">Nafiuzzaman</option>
							<option value="75">Md. Mehrab(Trino)</option><option value="76">Mamunur Rashid</option>
							<option value="77">Zilon Zilon</option><option value="62">Priyanka 	Sarker</option>
						</select></td>
				</tr>
					<tr valign="top">
					<td>Supervisor</td>
					<td><input type="text" value= "<?php echo $supervisor; ?>" name="supervisor" readonly="readonly"/></form></td>
				</tr>
				<tr valign="top">
					<td>Message</td>
					<td><textarea name="message" cols="18" rows="7"></textarea></td>
				</tr>
				<tr>
					<td>&nbsp;
						
					</td>
					<td>
						<input type="submit" value="submit" style="width:inherit; float:right; margin-right: 70px;"/>
					</td>
				</tr>
			</table>
		</form>
	<?php
		}
		if ($checkSubmit ==2)
		{
	?>
			<link rel="stylesheet" type="text/css" href="show_report.css" />
			<table cellpadding="0" cellspacing="0" width="800">
        	<tr class="table_header_1"  valign="top" width="300px;">            	                
            	<td colspan="5">
                	<p>Black Box Message</p>
                </td>
            </tr>
			<tr valign="top" class="table_header_2">
				<td width="70px;;"><p>Date</p></td>
            	<td width="60px"><p>Sender</p></td>
                <td width="100px;"><p>Recipient</p></td>
                <td width="60px;" colspan="2"><p>Message</p></td>
            </tr>
			 <?php							
				$collectData = "SELECT * FROM black_box_message WHERE status=1";
				$collectDataQuery = mysql_query($collectData);
				while($collectDataFetchArray = mysql_fetch_array($collectDataQuery)){
					$collectDate = $collectDataFetchArray['Date'];
					$collectSender = $collectDataFetchArray['sender'];
					$collectRecipient = $collectDataFetchArray['to_whom'];
					$collectMessage = $collectDataFetchArray['message'];
					$collectId = $collectDataFetchArray['id'];
			?>
            <tr valign="top" class="table_header_3">
            	<td width="60px"><p><?php echo $collectDate; ?></p></td>
                <td width="100px;"><p><?php echo $collectSender; ?></p></td>
                <td width="60px;"><p><?php echo $collectRecipient; ?></p></td>
				<td width="60px;"><p><?php echo $collectMessage; ?></p></td>
                <td width="70px;"><p><a href="check_blackbox.php?carryName=<?php echo $collectId;?>">Delete</a></p></td>                          
            </tr>
            <?php } ?>
		</table>
	<?php
		}
		if ($checkSubmit == 3)
		{
		$notificationSql = "SELECT * FROM black_box_message WHERE to_whom_id = '$ID' AND status = 1";
		$notificationSqlQuery = mysql_query($notificationSql);
	?>
		<table  border="0" cellpadding="0" cellspacing="0" class="header_page_content">
			<tr class="table_header_1"  valign="top">
				<td align="center" colspan="8">Black Box Message</td>
			</tr>
			<tr valign="top" class="table_header_2">
				<td width="100px"><p>Date</p></td>
				<td width="100px"><p>Message</p></td>
				<td width="100px"><p>Delete</p></td>
			</tr>
    	</table>	
		</table>
			<?php 
				while($data = mysql_fetch_assoc($notificationSqlQuery))
				{
			?>
					<table class="header_page_content" border="0" cellpadding="0" cellspacing="0">
						<tr valign="top" class="table_header_3">
							<td width="100px"><p><?php echo $data['Date'];?></p></td>
							<td width="100px"><p><?php echo $data['message'];?></p></td>
							<td width="100px"><p><a href="ceo_blackbox.php?delete=<?php echo $data['id'];?>">Delete</a></p></td>
						</tr>
					</table>
			<?php
				}
			}
			?>
</div>
</body>
</html>

